home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hráč 2004 August
/
Hrac_72_2004-08_dvd.iso
/
dema
/
Rapid Gun
/
rg_setup.exe
/
common
/
image_PencilSketch.fx
< prev
next >
Wrap
Text File
|
2004-04-19
|
2KB
|
101 lines
// LF2 Engine
// (C) 2002-3 7FX
//---------------------------------------------------------------------------
// Desc
string desc : Description = "Image shader - pencil sketch.";
// Shader type phase
string type : Type = "image";
//---------------------------------------------------------------------------
// Render target texture
texture RT : RenderTargetFSMap;
// Stroke pattern texture
texture2D Stroke
<
string file = "hatchrb.jpg";
>;
//---------------------------------------------------------------------------
sampler sRT = sampler_state
{
Texture = <RT>;
MinFilter = POINT;
MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
};
//---------------------------------------------------------------------------
sampler sStroke = sampler_state
{
Texture = <Stroke>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = POINT;
};
//---------------------------------------------------------------------------
float c0 = 0.5;
float3 c1 = {1.0, 0.0, 0.0};
float3 c2 = {0.0, 0.0, 1.0};
// Constant for luminance calculation
const float4 cLum = {0.3f, 0.59f, 0.11f, 1.f};
// Pixel shader
float4 PS(float2 uv: TEXCOORD0) : COLOR
{
float3 samp = 4 * tex2D(sRT, uv);
float3 r0 = saturate(samp * c0);
r0 = (1-r0) * (1-tex2D(sStroke, 12*uv).rgb);
float4 r1 = saturate(dot(r0, c1));
r1.rgb = saturate(dot(r0, c2));
r1.rgb = (1-r1) * (1-r1.a);
r0 = saturate(samp);
r0 = (saturate(2*(r1 - 0.25)) * r0);
return float4(r0, 1);
}
//---------------------------------------------------------------------------
technique vs0_ps11
{
pass p0
{
ZEnable = false;
ZWriteEnable = false;
PixelShader = compile ps_2_0 PS();
/*Sampler[0] = <sRT>;
Sampler[1] = <sStroke>;
PixelShader = asm
{
ps.1.1
def c0, 0.3, 0.3, 0.3, 0.0
def c1, 1.0, 0.0, 0.0, 0.0
def c2, 0.0, 0.0, 1.0, 0.0
tex t0
tex t1
mul_x4_sat r0.rgb, t0, c0
mul r0.rgb, 1-r0, 1-t1
dp3_sat r1.rgba, r0, c1
dp3_sat r1.rgb, r0, c2
mul r1.rgb, 1-r1, 1-r1.a
mov_x4_sat r0.rgb, t0
mul r0.rgb, r1_bx2, r0
mov_x2 r0.rgb, r0, v0
+ mov r0.a, c1.r
};*/
}
}
//---------------------------------------------------------------------------